package haxe.util.unit;
import haxe.util.LinkedList;

class TestLinkedList extends TestCollection
{
	private var l:LinkedList<Dynamic>;
	
	public function setup():Void
	{
		this.c = new LinkedList<Dynamic>();
		this.l = cast( this.c, LinkedList<Dynamic> );
	}
	
	public function testIterateBackward():Void
	{
		this.c.clear();
		for ( i in 0...100 )
		{
			c.add( i );
		}
		var j = 99;
		for( i in l.backward )
		{
			this.assertEquals( j, i );
			--j;
		}
		this.assertEquals( 100, c.size );
	}
	
	public function testIterateForward():Void
	{
		this.c.clear();
		for ( i in 0...100 )
		{
			c.add( i );
		}
		var j = 0;
		for ( i in c )
		{
			this.assertEquals( j, i );
			++j;
		}
		this.assertEquals( 100, c.size );
	}
}